<#include "./template.ftl">

<#macro head>
<title>百科-Morketing</title>
<link rel="stylesheet" href="${base}/client/css/baike.css">
</#macro>
<#macro content>
<div id="contents">
    <div class="baike-bar">
        <h2>行业百科</h2>
    </div>
    <#if bake??>
    <div class="main wrap clearfix baike-wrap">
        <div class="main-left f-r clearfix">
            <div class="baike-detail">
                <h2 class="h2">${bake.title}</h2>
                <p class="tips" style="text-align:center;"><span>来源: 程序化辞典</span></p>
                <div class="pic"><img width="100%" src="${base}/system/getImg?imgId=${bake.imgUrl}&w=800" alt=""></div>
                <div class="p">${bake.content}</div>
            </div>
            <div class="detail-heart">
                <a title="喜欢就赞一个！" id="favorite" href="javascript:;" data-action="ding" data-id="${bake.id}"
                   class="${done!''}">
                    <i class="fa fa-heart"></i> Like <span class="count">${bake.likes!''}</span>
                </a>
            </div>
        </div>
        <div class="main-right f-l clearfix">
            <dl class="baike-subnav">
                <dt>百科导航</dt>
                <#if cats??>
                    <#list cats as cat>
                        <dd <#if activityCat??><#if cat.id == activityCat>class="active"</#if></#if> ><a href="${base}/baike/cat/${cat.id}">${cat.name}</a></dd>
                    </#list>
                </#if>
            </dl>
        </div>
    </div>
    </#if>
</div>
</#macro>
<#macro js>
<script type="text/javascript">
    $(document).ready(function () {
        var postLike = function () {
            if ($("#favorite").hasClass('done')) {
                return false;
            } else {
                $("#favorite").addClass('done');
                var id = $("#favorite").data("id"),
                        rateHolder = $("#favorite").children('.count');
                var ajax_data = {
                    id: id
                };
                $.post("${base}/baike/up", ajax_data,
                        function (data) {
                            $(rateHolder).html(data.data);
                        });
                return false;
            }
        };
        $(document).on("click", "#favorite",
                function () {
                    postLike();
                });
    });
</script>
</#macro>